home *** CD-ROM | disk | FTP | other *** search
- /* ||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
- Icon List Item Object
-
- Defines an object that holds an icon from a resource file
- |||||||||||||||||||||||||||||||||||||||||||||||||||||||||||| */
-
- #include "CIconItemObj.h"
- #include <color.h>
-
- /* |||||||||||||||||||| */
- void CIconItemObj::DrawItem ( Boolean selected, Rect *dispR )
- {
- Rect arect;
- Str255 numStr;
-
- /*** draw an icon item (expects dispR to be at least 40 pixels high) */
- EraseRect ( dispR );
-
- /*** draw the icon (inset by 4 pixels) */
- arect = *dispR;
- arect.top += 4;
- arect.bottom = arect.top +32;
- arect.left += 4;
- arect.right = arect.left + 32;
- PlotIcon ( &arect, bits );
-
- /*** display the name and id next to it */
- TextFont ( systemFont );
- TextSize ( 12 );
- TextFace ( 0 );
- arect.left = arect.right + 8;
- arect.right = arect.left + 40;
- arect.top += 9;
- arect.bottom -= 9;
- NumToString ( (long) id, numStr );
- TextBox ( &numStr[1], (int) numStr[0], &arect, teJustLeft );
-
- TextFont ( geneva );
- TextSize ( 9 );
- arect.left = arect.right + 8;
- arect.right = dispR->right;
- arect.bottom += 16;
- TextBox ( &name[1], (int) name[0], &arect, teJustLeft );
-
- /*** if selected, invert the rect (could use hilite mode) */
- if ( selected ) {
- InvertRect ( dispR );
- }
- }
-